<%@page import="org.apache.catalina.User"%>
<%@page import="javax.persistence.EntityManager"%>
<%@page import="javax.persistence.EntityManagerFactory"%>
<%@page import="javax.persistence.Query"%>
<%@page import="multiface.awwadco.jpa.Utente"%>
<%@page import="java.util.*"%>
<%@page import="multiface.awwadco.jpa.PersistenceManager"%>
<%
        EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();
        EntityManager em = emf.createEntityManager();
        
        
        int uid = Integer.parseInt(request.getParameter("uid"));
        int adminID = Integer.parseInt(request.getParameter("admin_id"));
        Utente user = em.find(Utente.class,uid);
        
 %>

 <div>Select the administrator will be assigned to which news of</div><br><div style="font-size: 11px;"><%=user.getNome()%> <%= user.getCognome()%> (<%=user.getUser()%>) to >>
<select id="ot_admin" name="ot_admin">
    <%
        List<Utente> listAll = new LinkedList<Utente>();
        Query qAll = em.createQuery("SELECT p FROM Utente p", Utente.class);
        listAll = qAll.getResultList();
        Iterator<Utente> itAll = listAll.iterator();
        while (itAll.hasNext()) {
            Utente temp = itAll.next();
            if (temp.getIdutente() != uid) {
                out.println("<option value=\"" + temp.getIdutente() + "\">" + temp.getNome() + " " + temp.getCognome() + " (" + temp.getUser() + ")" + "</option>");
            }
        }

        em.close();
    %>
</select>
</div>
<div>
    <a href="javascript:del('user','<%=uid%>','<%=adminID%>');">Delete user</a>
</div>